package com.banmao.mall.mapper;

import com.banmao.mall.model.pojo.Coupon;
import com.banmao.mall.model.pojo.CouponUser;
import com.banmao.mall.model.vo.admin.promote.coupons.CouponItemsBean;
import com.banmao.mall.model.vo.client.index.CouponVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface CouponMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Coupon record);

    int insertSelective(Coupon record);

    Coupon selectByPrimaryKey(Integer id);

    CouponVO selectVOByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Coupon record);

    int updateByPrimaryKey(Coupon record);

    List<CouponVO> selectAllCoupon();

    List<CouponVO> selectCouponsWithPageAndSize(@Param("page")Integer page,@Param("size")Integer size);


    Integer selectTotal(Integer i, Integer limit, String sort, String order, String name, Integer type, Integer status);


    List<CouponItemsBean> selectCouponList(Integer i, Integer limit, String sort, String order, String name, Integer type, Integer status);

    List<CouponUser> selectCouponUserByUserIdAndCouponId(@Param("userId") Integer userId, @Param("couponId") Integer couponId);

   Integer updateTotalById(@Param("id") Integer couponId,@Param("total")Integer total);


    public Coupon selectByCode(String code);

     Integer alterOutDateCouponStatus();

}